package org.gdgbologna.devfest;

import android.app.ActionBar;
import android.app.Activity;
import android.os.Bundle;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.MenuItem;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class AboutActivity extends Activity {
	
	RelativeLayout daniele;
	RelativeLayout luca;
	ApplicationDevFest app;

	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        setContentView(R.layout.about_activity);
        
        app = (ApplicationDevFest) getApplication();
        
        ActionBar actionBar = getActionBar();
    	actionBar.setDisplayHomeAsUpEnabled(true);
    	
    	actionBar.setTitle(R.string.actionbar_about);
    	
    	daniele = (RelativeLayout) findViewById(R.id.card_daniele);
    	ImageView image = (ImageView) daniele.findViewById(R.id.image_card);
    	image.setImageDrawable(this.getResources().getDrawable(R.drawable.daniele));
    	TextView name = (TextView) daniele.findViewById(R.id.title_card);
    	name.setText("Daniele Bottillo");
    	
    	TextView text = (TextView) daniele.findViewById(R.id.text_card);
    	text.setMovementMethod(LinkMovementMethod.getInstance());
    	text.setText(Html.fromHtml("GDG Bologna <br/><br/>"+
    	"<i>Email:</i><br/><a href=\"mailto:dbottillo@gmail.com\">dbottillo@gmail.com</a><br/><br/>"+
    	"<i>Google+:</i><br/><a href=\"https://plus.google.com/106913999070037388765/\">https://plus.google.com/106913999070037388765/</a><br/><br/>"+
    	"<i>"+getString(R.string.website)+":</i><br/><a href=\"http://www.danielebottillo.com\">www.danielebottillo.com</a>"));
    	
    	luca = (RelativeLayout) findViewById(R.id.card_luca);
    	image = (ImageView) luca.findViewById(R.id.image_card);
    	image.setImageDrawable(this.getResources().getDrawable(R.drawable.luca));
    	name = (TextView) luca.findViewById(R.id.title_card);
    	name.setText("Luca Leone");
    	text = (TextView) luca.findViewById(R.id.text_card);
    	text.setMovementMethod(LinkMovementMethod.getInstance());
    	text.setText(Html.fromHtml("GDG Bologna <br/><br/>"+
    	"<i>Email:</i><br/><a href=\"mailto:web.leone@gmail.com\">web.leone@gmail.com</a>"));
	}
	
	@Override
	public void onResume(){
		super.onResume();
		
		app.tracker.trackPageView("/about");
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case android.R.id.home:
			finish();
			return true;
		default:
			return super.onOptionsItemSelected(item);
		}
	}
}
